# -*- coding: UTF-8 -*-
# Author: Damon(wuud1)
# CreateDate: 
# Message:

# s = "onVehComClick('VCO0009','VP01');return false;"
# s = s.split(';')[0].replace("onVehComClick(", "").replace(")", "").replace("'", "").replace(",", "_")
# print(s)


# headers = {
# "Host": "service.citroen.com",
# "Upgrade-Insecure-Requests": "1",
# "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.96 Safari/537.36",
# "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
# "Referer": "http://service.citroen.com/docprAC/",
# "Accept-Encoding": "gzip, deflate",
# "Accept-Language": "zh-CN,zh;q=0.9",
# "Cookie": "BIGipServerNEWAPVPROI_OIT.app~NEWAPVPROI_OIT_pool=496009226.20480.0000; PSACountry=CN; CodeLanguePaysOI=zh_CN; PGAN65374651=10; DISPLAYDOCAN65374651=1; _pk_id.78.196e=b6d3675882a9c8ed.1551104401.4.1551157395.1551157395.; _pk_ses.66.196e=*; JSESSIONID=0000GIDd_LoqHlOiR2y5sdFvVip:1c0on7jcr; _pk_id.66.196e=da231deb4d00e588.1551084352.8.1551186255.1551184494.",
# "Connection": "keep-alive",
# }
#
#
# url = 'http://service.citroen.com/docprAC/vehCom.do?cat=VP04&vehCom=VCO0180&lcdv=B0D%3D%26B0F%3D'
#
# import requests
# requests.get(url=url, headers=headers)

# with open('/Users/duanmengdi/Desktop/charlesHtml/vehCom.do.html', 'r') as f:
#     res = f.read()
# import re
# s = re.findall('setFctNiv1Select\((.*?)\)', res)[0]

# s = '''{"fctionsDependantes":[{"fctionsDependantes":[{"fctionsDependantes":[],"grisee":false,"id":"FCT0049","imageFct":"Fct20100503165049615.jpg","libelleFct":"发动机总成","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"1"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0004","imageFct":"Fct20091028155419386.jpg","libelleFct":"发动机缸体","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"2"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0005","imageFct":"Fct20091028112003836.jpg","libelleFct":"曲轴","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"3"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0006","imageFct":"Fct20091028155432171.jpg","libelleFct":"缸盖","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"4"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0007","imageFct":"Fct20091028112027824.jpg","libelleFct":"正时齿轮","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"5"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0008","imageFct":"Fct20091028112048497.jpg","libelleFct":"润滑油","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"6"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0009","imageFct":"Fct20091028112106563.jpg","libelleFct":"冷却系统","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"7"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0010","imageFct":"Fct20091210110912149.jpg","libelleFct":"发动机燃油系","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"8"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0011","imageFct":"Fct20091028112125630.jpg","libelleFct":"排气","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"9"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0012","imageFct":"Fct20091210110942269.jpg","libelleFct":"排放控制","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"10"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0013","imageFct":"Fct20091028112144063.jpg","libelleFct":"点火","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"11"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0014","imageFct":"Fct20091028112202922.jpg","libelleFct":"涡轮增压","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"12"}],"grisee":false,"id":"FCT0512","imageFct":"Fct20091028113400134.jpg","libelleFct":"发动机","listeEffetClient":[],"niveauFct":2,"ordreAffichage":"1"},{"fctionsDependantes":[{"fctionsDependantes":[],"grisee":false,"id":"FCT0016","imageFct":"Fct20091028112239854.jpg","libelleFct":"离合器","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"1"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0017","imageFct":"Fct20091028112303709.jpg","libelleFct":"变速箱","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"2"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0018","imageFct":"Fct20091028112322653.jpg","libelleFct":"变速箱控制装置","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"3"}],"grisee":false,"id":"FCT0015","imageFct":"Fct20091028112220614.jpg","libelleFct":"变速箱总成","listeEffetClient":[],"niveauFct":2,"ordreAffichage":"2"},{"fctionsDependantes":[{"fctionsDependantes":[],"grisee":false,"id":"FCT0020","imageFct":"Fct20091028112355637.jpg","libelleFct":"分动箱","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"1"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0021","imageFct":"Fct20091028112410428.jpg","libelleFct":"后主减速器","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"2"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0022","imageFct":"Fct20091028112433455.jpg","libelleFct":"传动","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"3"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0023","imageFct":"Fct20091028112449090.jpg","libelleFct":"车轮","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"4"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0024","imageFct":"Fct20091028112504687.jpg","libelleFct":"轮胎","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"5"}],"grisee":false,"id":"FCT0019","imageFct":"Fct20091028112339899.jpg","libelleFct":"变速器","listeEffetClient":[],"niveauFct":2,"ordreAffichage":"3"},{"fctionsDependantes":[{"fctionsDependantes":[],"grisee":false,"id":"FCT0337","imageFct":"Fct20091210122038993.jpg","libelleFct":"悬架","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"1"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0026","imageFct":"Fct20091028112537202.jpg","libelleFct":"前轴","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"2"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0027","imageFct":"Fct20091028112550600.jpg","libelleFct":"前弹簧","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"3"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0028","imageFct":"Fct20091028112605303.jpg","libelleFct":"前减震器","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"4"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0029","imageFct":"Fct20091028112615696.jpg","libelleFct":"前横向稳定杆","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"5"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0030","imageFct":"Fct20091028112629003.jpg","libelleFct":"后轴","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"6"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0031","imageFct":"Fct20091028112655856.jpg","libelleFct":"后弹簧","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"7"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0032","imageFct":"Fct20091028112709616.jpg","libelleFct":"后减震器","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"8"}],"grisee":false,"id":"FCT0025","imageFct":"Fct20091028112522183.jpg","libelleFct":"悬架总成","listeEffetClient":[],"niveauFct":2,"ordreAffichage":"4"},{"fctionsDependantes":[{"fctionsDependantes":[],"grisee":false,"id":"FCT0034","imageFct":"Fct20091028112734261.jpg","libelleFct":"方向盘和方向盘控制装置","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"1"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0035","imageFct":"Fct20091028112748762.jpg","libelleFct":"转向柱","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"2"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0036","imageFct":"Fct20091028112801620.jpg","libelleFct":"防盗","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"3"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0037","imageFct":"Fct20091028112828895.jpg","libelleFct":"转向齿条","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"4"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0339","imageFct":"Fct20091029160043835.jpg","libelleFct":"助力转向","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"5"}],"grisee":false,"id":"FCT0033","imageFct":"Fct20091028112722068.jpg","libelleFct":"转向","listeEffetClient":[],"niveauFct":2,"ordreAffichage":"5"},{"fctionsDependantes":[{"fctionsDependantes":[],"grisee":false,"id":"FCT0040","imageFct":"Fct20091028155449136.jpg","libelleFct":"前制动器","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"1"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0041","imageFct":"Fct20091028155503143.jpg","libelleFct":"后轮制动器","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"2"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0042","imageFct":"Fct20091028155517268.jpg","libelleFct":"管路","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"3"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0043","imageFct":"Fct20091028155527798.jpg","libelleFct":"平衡器","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"4"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0044","imageFct":"Fct20091210111006949.jpg","libelleFct":"制动助力","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"5"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0045","imageFct":"Fct20091028155538270.jpg","libelleFct":"制动总泵","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"6"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0046","imageFct":"Fct20091028155548262.jpg","libelleFct":"驻车制动器","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"7"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0047","imageFct":"Fct20091028155601048.jpg","libelleFct":"踏板支架","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"8"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0340","imageFct":"Fct20091210111238606.jpg","libelleFct":"ABS/ASR/ESP","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"9"},{"fctionsDependantes":[],"grisee":false,"id":"FCT0056","imageFct":"Fct20160525164544467.png","libelleFct":"制动个性化","listeEffetClient":[],"niveauFct":3,"ordreAffichage":"10"}],"grisee":false,"id":"FCT0039","imageFct":"Fct20091028112851594.jpg","libelleFct":"制动","listeEffetClient":[],"niveauFct":2,"ordreAffichage":"6"}],"grisee":false,"id":"FCT0001","imageFct":"","libelleFct":"机械装置","listeEffetClient":[],"niveauFct":1,"ordreAffichage":"4"}'''
#
# import json
#
# _j = json.loads(s)
# fctionsDependantes = _j.get("fctionsDependantes")
# groupList = []
# for info in fctionsDependantes:
#     groupDict = {}
#     groupDict["groupName"] = info.get("libelleFct")
#     groupDict["groupId"] = info.get("id")
#     groupDict["groupImg"] = info.get("imageFct")
#     subgroupList = info.get("fctionsDependantes")
#     subList = []
#     for subgroupInfo in subgroupList:
#         subDict = {}
#         subDict["subgroupName"] = subgroupInfo.get("libelleFct")
#         subDict["subgroupId"] = subgroupInfo.get("id")
#         subDict["subgroupImg"] = subgroupInfo.get("imageFct")
#         subList.append(subDict)
#     groupDict["subList"] = subList
#     groupList.append(groupDict)
# print(groupList)


# s = '''{"listDocPourAffichage":{"documentListeSize":24,"listeDesDocuments":[{"applicabilite":"DV4TD柴油涡轮增压","applicabiliteNonTraduite":"{(?1CA6)(B0F7P)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002050A","referenceAffichable":"0110 01 002050A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"DV6TED4 柴油涡轮电喷FAP","applicabiliteNonTraduite":"{(?1CA6)(B0F9W)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002060A","referenceAffichable":"0110 01 002060A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU1A电喷","applicabiliteNonTraduite":"{(?1CA6)(B0F3S)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002006A","referenceAffichable":"0110 01 002006A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU1JP 喷射 和 DEPOL TECH VEHICULE IFL5 EURO 4 INCITATION FISCALE","applicabiliteNonTraduite":"{(?1CA6)(B0F6P)(DUV08)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002005A","referenceAffichable":"0110 01 002005A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU1JP 喷射 和 DEPOLLUTION TECHNIQUE VEHICULE L4 EURO 3","applicabiliteNonTraduite":"{(?1CA6)(B0F6P)(DUV07)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002001A","referenceAffichable":"0110 01 002001A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU3A电喷","applicabiliteNonTraduite":"{(?1CA6)(B0FS1)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002012A","referenceAffichable":"0110 01 002012A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU5JP4 喷射","applicabiliteNonTraduite":"{(?1CA6)(B0F6S)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002020A","referenceAffichable":"0110 01 002020A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU5JP4S电喷","applicabiliteNonTraduite":"{(?1CA6)(B0FFG)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002025A","referenceAffichable":"0110 01 002025A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"喷射ET3J4","applicabiliteNonTraduite":"{(?1CA6)(B0F1Z)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002017A","referenceAffichable":"0110 01 002017A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"喷射TU3JP 和 DEPOL TECH VEHICULE IFL5 EURO 4 INCITATION FISCALE","applicabiliteNonTraduite":"{(?1CA6)(B0F6Q)(DUV08)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002015A","referenceAffichable":"0110 01 002015A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"喷射TU3JP 和 DEPOLLUTION TECHNIQUE VEHICULE L4 EURO 3","applicabiliteNonTraduite":"{(?1CA6)(B0F6Q)(DUV07)}","aspect":"","codeTitre":"401","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002010A","referenceAffichable":"0110 01 002010A","referencePr":"","stock":0,"teinte":"","titre":"发动机","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"DV4TD柴油涡轮增压","applicabiliteNonTraduite":"{(?1CA6)(B0F7P)}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348050A","referenceAffichable":"0110 01 348050A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"DV6TED4 柴油涡轮电喷FAP","applicabiliteNonTraduite":"{(?1CA6)(B0F9W)}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348070A","referenceAffichable":"0110 01 348070A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU1A电喷 和 手动变速箱","applicabiliteNonTraduite":"{(?1CA6)(B0F3S)(@BVM)}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348003A","referenceAffichable":"0110 01 348003A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU1JP 喷射 和 手动变速箱","applicabiliteNonTraduite":"{(?1CA6)(B0F6P)(@BVM)}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348001A","referenceAffichable":"0110 01 348001A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU3A电喷","applicabiliteNonTraduite":"{(?1CA6)(B0FS1)}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348007A","referenceAffichable":"0110 01 348007A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU5JP4 喷射","applicabiliteNonTraduite":"{(?1CA6)(B0F6S)}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348010A","referenceAffichable":"0110 01 348010A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"TU5JP4S电喷","applicabiliteNonTraduite":"{(?1CA6)(B0FFG)}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348020A","referenceAffichable":"0110 01 348020A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"喷射ET3J4 终点 OPR 10919","applicabiliteNonTraduite":"{(?1CA6)(B0F1Z)/($,,1,10919)/}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348008A","referenceAffichable":"0110 01 348008A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"喷射ET3J4 起点 OPR 10920","applicabiliteNonTraduite":"{(?1CA6)(B0F1Z)/($1,10920,,)/}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348008B","referenceAffichable":"0110 01 348008B","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"喷射TU3JP 和 手动变速箱","applicabiliteNonTraduite":"{(?1CA6)(B0F6Q)(@BVM)}","aspect":"","codeTitre":"501","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001348005A","referenceAffichable":"0110 01 348005A","referencePr":"","stock":0,"teinte":"","titre":"发动机变速箱总成的固定","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"DV4TD柴油涡轮增压","applicabiliteNonTraduite":"{(?1CA6)(B0F7P)}","aspect":"","codeTitre":"9901","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002250A","referenceAffichable":"0110 01 002250A","referencePr":"","stock":0,"teinte":"","titre":"发动机罩","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"DV6TED4 柴油涡轮电喷FAP","applicabiliteNonTraduite":"{(?1CA6)(B0F9W)}","aspect":"","codeTitre":"9901","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002260A","referenceAffichable":"0110 01 002260A","referencePr":"","stock":0,"teinte":"","titre":"发动机罩","titreComp":"","traduit":false,"url":"","version":""},{"applicabilite":"喷射ET3J4","applicabiliteNonTraduite":"{(?1CA6)(B0F1Z)}","aspect":"","codeTitre":"9901","condi":"","conditionnement":null,"dateDiffusion":"","designation":"","designationCpl":"","detail":"","documentCampagne":false,"documentForfait":false,"documentPneu":false,"documentSecom":false,"documentTP":false,"dtcCaracterisation":"","dtcCode":"","dtcFamille":"","dtcStatut":"","forfaits":[],"fournisseur":" ","gamme":"","idFonction":"","idRupture":"","libRupture":"","lien":"","listFonction":[],"nature":"","origine":"","pays":"","paysExclusion":"","pertinence":"","refFantome":"","reference":"011001002201A","referenceAffichable":"0110 01 002201A","referencePr":"","stock":0,"teinte":"","titre":"发动机罩","titreComp":"","traduit":false,"url":"","version":""}],"listeReference":["011001002050A","011001002060A","011001002006A","011001002005A","011001002001A","011001002012A","011001002020A","011001002025A","011001002017A","011001002015A","011001002010A","011001348050A","011001348070A","011001348003A","011001348001A","011001348007A","011001348010A","011001348020A","011001348008A","011001348008B","011001348005A","011001002250A","011001002260A","011001002201A"],"moreThanMaxResult":false,"rechIdol":false,"typeDocument":1},"panierTempoCompteur":"","panierTempoZone":""}'''
# import json
# _j = json.loads(s)
# listeDesDocuments = _j.get("listDocPourAffichage").get("listeDesDocuments")
# for info in listeDesDocuments:
#     strucName = info.get("titre")
#     strucModel = info.get("applicabilite")
#     applicabiliteNonTraduite = info.get("applicabiliteNonTraduite")
#     strucId = info.get("reference")
#     refaff = info.get("referenceAffichable")
#     print(strucName, strucModel, applicabiliteNonTraduite, strucId, refaff)

# f = '/Users/duanmengdi/Desktop/workspace/py3_code/citroen_spider/citroenHtml/citroen/afficheVCO0069_VP01011001002050A.html'
# with open(f, 'r') as r:
#     res = r.read()
#
# import re
# imgPath = re.findall('var imgPath="(.*?)"', res)[0]
# print(imgPath)
# imgUrl = 'http://service.citroen.com/docprAC/{}'.format(imgPath)
# print(imgUrl)
# for i in range(4):
#     if i==0:
#         print('0')
#         l = [0, 1, 2, 3]
#         continue
#     print(l[i])

# s = '''Host: service.citroen.com
# User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.96 Safari/537.36
# Accept: image/webp,image/apng,image/*,*/*;q=0.8
# Referer: http://service.citroen.com/docprAC/fonction.do?idFction=FCT0200&topGrisageActif=true&tabTriEtAffich=1
# Accept-Encoding: gzip, deflate
# Accept-Language: zh-CN,zh;q=0.9
# Cookie: PSACountry=CN; CodeLanguePaysOI=zh_CN; PGAN65374651=10; DISPLAYDOCAN65374651=1; BIGipServerNEWAPVPROI_OIT.app~NEWAPVPROI_OIT_pool=529563658.20480.0000; _pk_id.78.196e=a621216d8b72f450.1551284223.2.1551326279.1551326252.; JSESSIONID=0000fug6N3yyv0Ut5RRRuKiBJVF:1c49c4fsm; _pk_ses.66.196e=*; _pk_id.66.196e=ace3dd478b6d0349.1551254759.5.1551332810.1551332446.
# Connection: keep-alive'''
#
#
# s_l = s.split("\n")
# for i in s_l:
#     k = i.split(": ")[0]
#     v = i.split(": ")[1]
#     print('"{}": "{}",'.format(k, v))

# s = '{"listDocPourAffichage":{"documentListeSize":0,"listeDesDocuments":[],"listeReference":[],"moreThanMaxResult":false,"rechIdol":false,"typeDocument":1},"panierTempoCompteur":"","panierTempoZone":""}'
#
# import json
# json.loads(s)


# s = '''<table id="repere1-1" class="tablepr" ref="00000135CW" img_details="null" desi="013644" prremps=""onMouseOut="onMouseOutWork(event,this)" onMouseOver="onMouseOverWork('1-1',this)" onClick="PRClick('1-1', true, event, this)" onDblClick="PRDblClick('1-1')"><tbody style="background-color: white;"><tr><td class="colrepere"><div class="repere">01</div></td><td class="colref"><div class="desi"><br/></div><div class="prsansprremp">0135 CW</div></td><td class="colcoef"><div class="desi"><br/></div><div class="coef">01</div></td><td class="coldesi"><div class="desi">新汽油发动机</div><div class="descomp"></div><div class="monte"> 标记 KFV</div><div class="microappl"></div><div class="obsligne"></div></td><td class="collink"></td></tr></table>
# <table id="repere1-2" class="tableprsamerepere" ref="00000139PH" img_details="null" desi="013646"onMouseOut="onMouseOutWork(event,this)" onMouseOver="onMouseOverWork('1-2',this)" onClick="PRClick('1-2', true, event, this)" onDblClick="PRDblClick('1-2')"><tbody style="background-color: white;"><tr><td class="colrepere"><div class="repere"></div></td><td class="colref"><div class="desi"><br/></div><div class="prsansprremp">0139 PH</div></td><td class="colcoef"><div class="desi"><br/></div><div class="coef">01</div></td><td class="coldesi"><div class="desi">翻新汽油发动机</div><div class="descomp"></div><div class="monte"> 标记 KFV</div><div class="microappl"></div><div class="obsligne"></div></td><td class="collink"></td></tr></table>'''
# from lxml import etree
#
# h = etree.HTML(s)
# tbl = h.xpath('//table')
# for tb in tbl:
#     print(tb)

import json
from lxml import etree


# def parse_parts(doc):
#     parts = doc.xpath('//div[@id="content"]/table')
#
#     # 获取描点信息字典
#     areas = doc.xpath('//map[@name="mapZoneSensible"]/area')
#     imgPoints = {}
#     for area in areas:
#         it = area.xpath('./@id')[0].split("_")[0].replace("area", "")
#         points = area.xpath('./@coords')[0].split(", ")
#         if it not in imgPoints:
#             imgPoints[it] = [points]
#         else:
#             imgPoints[it].append(points)
#
#     psort = 0
#     for tab in parts:
#         try:
#             pid = tab.xpath('.//tr[1]/td[@class="colref"]/div[@class="prsansprremp"]/text()')[0].replace(" ", "")
#             label = tab.xpath('.//tr[1]/td[@class="coldesi"]/div[@class="desi"]/text()')[0]
#             cote = tab.xpath('.//tr[1]/td[@class="coldesi"]/div[@class="cote"]/text()')
#             label = (label + '(' + cote[0] + ')') if len(cote) > 0 else label
#         except:
#             continue
#         # itid = tab.xpath('./@id')[0].split("-")[0][-1:]
#         itid = tab.xpath('./@ondblclick')[0].split("'")[1].split('-')[0]
#         for ix, tr in enumerate(tab.xpath('.//tr')):
#             psort += 1
#             qty = tr.xpath('./td[@class="colcoef"]/div[@class="coef"]/text()')
#             qty = qty[0] if len(qty) > 0 else ''
#             descomp = tr.xpath('./td[@class="coldesi"]/div[@class="descomp"]/text()')
#             descomp = descomp[0] if len(descomp) > 0 else ""
#             remark = tr.xpath('./td[@class="coldesi"]/div[@class="microappl"]/text()')
#             remark = remark[0] if len(remark) > 0 else ""
#             model = tr.xpath('./td[@class="coldesi"]/div[@class="obsligne"]/text()')
#             model = model[0] if len(model) > 0 else ""
#             _dict = {}
#             _dict["pid"] = str(pid)
#             _dict["label"] = str(label)
#             _dict["psort"] = psort
#             _dict["itid"] = str(itid)
#             _dict["remark"] = str(remark)
#             _dict["quanty"] = str(qty)
#             _dict["model"] = str(model)
#             _dict["condition"] = str(descomp)
#             _dict["img"] = imgPoints.get(itid)
#
#             yield _dict
#
#
#
# with open('/Users/duanmengdi/Desktop/parts.html', 'r') as f:
#     res = f.read()
# doc = etree.HTML(res)
# for p in parse_parts(doc):
#     print(p)




p1 = '/Users/duanmengdi/Desktop/FCT0954的副本.png'
p2 = '/Users/duanmengdi/Desktop/FCT0955的副本.png'

b1 = open(p1, 'rb').read()
b2 = open(p2, 'rb').read()

import hashlib
def _get_md5(b):
    '''获取md5加密电子指纹'''
    _md5 = hashlib.md5()
    _md5.update(b)
    return _md5.hexdigest()

m1 = _get_md5(b1)
m2 = _get_md5(b2)
print(m1)
print(m2)
if m1==m2:
    print('xx')


















